bitkeeper revision 1.1385.1.2 (426ebce6uikcKvm56neQ1G3uFEGApw)
authorbren@br260.wolfson.cam.ac.uk <bren@br260.wolfson.cam.ac.uk>
Tue, 26 Apr 2005 22:12:54 +0000 (22:12 +0000)
committerbren@br260.wolfson.cam.ac.uk <bren@br260.wolfson.cam.ac.uk>
Tue, 26 Apr 2005 22:12:54 +0000 (22:12 +0000)
Properly set memory parameters for newly created domains.

Signed-off-by: Bin Ren <bin.ren@cl.cam.ac.uk>
tools/libxc/xc_domain.c
xen/common/dom0_ops.c
xen/common/dom_mem_ops.c

index 1d8815a8a67c53e8b878c56709418bc4a92ef824..85bd4811805d36027c89582d0fef6c36d3a66cf9 100644 (file)
@@ -35,7 +35,7 @@ int xc_domain_create(int xc_handle,
         goto fail;
 
     if ( (err = do_dom_mem_op(xc_handle, MEMOP_increase_reservation,
-                              NULL, mem_kb/4, 0, *pdomid)) != (mem_kb/4) )
+                              NULL, mem_kb/4 + 1, 0, *pdomid)) != (mem_kb/4) )
     {
         if ( err > 0 )
             errno = ENOMEM;
index da454a479a1723130e5352c1cde9a650779bf129..0d3966f994a2eb9f71eee65a9b52a2fbd58f4473 100644 (file)
@@ -411,7 +411,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         d = find_domain_by_id(op->u.setdomainmaxmem.domain);
         if ( d != NULL )
         {
-            d->max_pages = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10);
+            d->max_pages = (op->u.setdomainmaxmem.max_memkb +
+                            ((PAGE_SIZE-1)>>10)) >> (PAGE_SHIFT-10);
             put_domain(d);
             ret = 0;
         }
index 698f6ee835c5aa388156a95b0b1cad920a557580..9b5d50cfc21af74f77940562dc5bb3c8aaa23969 100644 (file)
@@ -61,6 +61,9 @@ alloc_dom_mem(struct domain *d,
             return i;
         }
 
+        /* Initialise the machine-to-phys mapping for this page. */
+        set_machinetophys(page_to_pfn(page), d->tot_pages - 1);
+
         /* Inform the domain of the new page's machine address. */ 
         if ( (extent_list != NULL) && 
              (__put_user(page_to_pfn(page), &extent_list[i]) != 0) )